<?php
namespace BP\DA;

use BP\Sys\SystemConfig;
use think\Log as ThinkLog;
// require_once("org/slf4j/Logger.php");
// require_once("org/slf4j/LoggerFactory.php");
class Log{
// 	protected static $logger;	// Logger
	public static function __staticinit() { // static class members
// 		self::$logger = $LoggerFactory->getLogger(Log);
	}
	public static function DebugWriteInfo ($msg) // [String msg]
	{
		Log::DefaultLogWriteLine(LogType::Info, $msg);
	}
	public static function DebugWriteWarning ($msg) // [String msg]
	{
		Log::DefaultLogWriteLine(LogType::Warning, $msg);
	}
	public static function DebugWriteError ($msg) // [String msg]
	{
		Log::DefaultLogWriteLine(LogType::Error, $msg);
	}
	public static function isLoggerDebugEnabled () 
	{
		return SystemConfig::getIsDebug();
	}
	public static function DefaultLogWriteLineDebug ($msg) // [String msg]
	{
		Log::DefaultLogWriteLine(LogType::Debug, $msg);
	}
	public static function DefaultLogWriteLineInfo ($msg) // [String msg]
	{
		Log::DefaultLogWriteLine(LogType::Info, $msg);
	}
	public static function DefaultLogWriteLineWarning ($msg) // [String msg]
	{
		Log::DefaultLogWriteLine(LogType::Warning, $msg);
	}
	public static function DefaultLogWriteLineError_String ($msg) // [String msg]
	{
		Log::DefaultLogWriteLine(LogType::Error, $msg);
	}
	public static function DefaultLogWriteLineError_String_Throwable ($msg, $ex) // [String msg, Throwable ex]
	{
	    Log::DefaultLogWriteLine(LogType::Error, $msg);
	}
	public static function DefaultLogWriteLine ($type, $info) // [LogType type, String info]
	{
		switch ($type) {
		    case LogType::Debug:
// 				self::$logger->debug($info);
				ThinkLog::record($info, ThinkLog::DEBUG);
				break;
		    case LogType::Info:
// 				self::$logger->info($info);
		        ThinkLog::record($info, ThinkLog::INFO);
		        break;
		    case LogType::Warning:
// 				self::$logger->warn($info);
				ThinkLog::record($info, ThinkLog::ALERT);
				break;
		    case LogType::Error:
// 				self::$logger->error($info);
				ThinkLog::record($info, ThinkLog::ERROR);
				break;
		}
	}
}
Log::__staticinit(); // initialize static vars for this class on load
?>
